package cn.example.query;

import cn.example.pojo.Business;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.Data;

@Data
public class BusinessQuery extends BaseQuery {

    private String businessName; //商家名称模糊搜索的条件
    private String businessAddress;//商家地址模糊搜索的条件

    @Override
    public Wrapper getQueryWrapper() {
        QueryWrapper<Business> businessQueryWrapper = new QueryWrapper<>();
        if(StringUtils.isEmpty(businessName)){
            businessQueryWrapper.like("businessName",businessName);
        }
        if(StringUtils.isEmpty(businessAddress)){
            businessQueryWrapper.like("businessAddress",businessAddress);
        }
        return businessQueryWrapper;
    }
}
